import time

from selenium.webdriver.common.by import By


class PageBackendBatchDerive():
    def __init__(self,driver):
        self.driver=driver

    #选择商品列表
    def ele_derive_list(self):
        self.driver.find_element(By.ID, 'search_submit').click()

    #添加导出商品到列表
    def ele_add_list(self):
        self.driver.find_element(By.ID, 'addAllGoods').click()

    #点击【导出】
    def ele_accept_list(self):
        self.driver.find_element(By.ID, 'submit').click()

    #进入右侧mainframe
    def ele_main_frame(self):
        self.driver.switch_to.frame('main-frame')

    # 退出frame
    def ele_frame_out(self):
        self.driver.switch_to.default_content()

    def derive_list(self):
        self.ele_main_frame()
        self.ele_derive_list()
        self.ele_add_list()
        self.ele_accept_list()
        self.ele_frame_out()
